package ObjectClass

object extendsTest {
  def main(args: Array[String]): Unit = {
    val man = new Man()
    val woman = new Woman()
    man.info()
    man.info2()

    woman.info()
    woman.info2()
  }
}

abstract class human {
  val sex: String

  def info()

  def info2() {
    println("你好,人类")
  }
}

class Man extends human {
  override val sex: String = "男"

  override def info(): Unit = {
    printf("这是一个%s人\n", sex)
  }

  override def info2(): Unit = {
    println("你好,男人")
  }
}
class Woman extends human {
  override val sex: String = "女"

  override def info(): Unit = {
    printf("这是一个%s人\n", sex)
  }

  override def info2(): Unit = {
    println("你好,女人")
  }
}